<?php defined('SYSPATH') or die('No direct script access.'); ?>
<script type="text/javascript" src="/js/sorttable.js"></script>
<style type="text/css">
    table.userlist {
        margin: 20px auto;
        width: 100%;
        text-align: left;
        border-collapse: collapse;
    }
    .userlist .main td {
        background-color: #555555;
        color: #ffffff;
        padding: 5px 10px;
        font-weight: normal;
    }
    .userlist th {
        background-color: #555555;
        color: #ffffff;
        padding: 5px 10px;
        font-weight: normal;
    }
    .userlist td {
        color: #666666;
        padding: 5px 10px;
    }
    .userlist a {
        color: #666666;
        font-weight: bold;
    }
</style>
<?php if(count($users)): //$items can be array('purchaseURL' => '') ?>
<h1 style="text-align: center">Users</h1>
<br />
<center>
    <table class="sortable userlist">
    <thead>
        <tr>
            <th>Name</th><th>Last login</th><th>Email</th><th>Network</th>
            <th>Comments</th><th>Ban</th><th>Delete</th>
        </tr>
    </thead>
    <tbody>
        <?php foreach($users as $user):?>
        <tr>
            <td><?php echo $user->username;?></td>
            <td><?php echo $user->last_login ? date('Y-m-d H:i', $user->last_login) : '---';?></td>
            <td><?php echo $user->email;?></td>
            <td><?php echo $user->network;?></td>
            <td><?php echo $user->comments;?></td>
            <td>
                <?php if($user->banned):?>
                    Banned
                <?php else:?>
                    <a href="/shop/ban?user=<?php echo $user->id;?>">Ban</a>
                <?php endif;?>
            </td>
            <td>
                <a href="/shop/delete?user=<?php echo $user->id;?>">Delete</a>
            </td>
        </tr>
        <?php endforeach;?>
    </tbody>
    </table>
</center>
<?php else: ?>
    <br /><br /><br />
    <center>There is no users on site</center>
    <br /><br />
<?php endif;
